import Taro, { Component } from '@tarojs/taro'
import { View, Text,Image } from '@tarojs/components'
import { AtIcon } from "taro-ui"
import ImageCom from '../image-com/image-com'

import "./news-item.scss"



class NewsItem extends Component {
  constructor(props) {
    super(props)
    this.state={
      date:new Date()
    }
  }

  componentWillMount() {}
  componentDidMount() {}

  componentWillUnmount() {
  }
  
  render() {
    return (
      <View className='news-item' onClick={()=>{
          Taro.navigateTo({
            url: `/pages/webnews/webnews?newsId=${this.props.newsId}`
          })
      }}
      >
        <View className='news-container'>
          <View className='news-image'>
            <ImageCom
              className='news-img'
              src={this.props.imgsrc}
            />
          </View>
          <View className='news-title'>
            <View className='title-text'>{this.props.title}</View>
            <Text className='desc-text'>{this.props.desc}</Text>
            {this.props.binding && <View><Text className='binding-text'>{this.props.binding}</Text></View>}
            <View>
              {this.props.price && <Text className='price-text'>￥{this.props.price }</Text>}
            </View>
          </View>

          <View className='news-info'>
            <View className='publish-info'>
              <ImageCom
                type='person'
                className='info-avatar' 
                src={this.props.avatar}
              />
              <Text className='info-text'>{this.props.publisher}</Text>
            </View>
            {/* <View class='like-info'>

              <AtIcon className='icon-heart' value='heart' size='18' color='#ccc'></AtIcon>
              <Text className='info-text'>{this.props.zan_num}</Text>
            </View> */}
            
          </View>

        </View>
      </View>
    )
  }
}

export default NewsItem
